package com.p2p.front.web.form;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.p2p.base.model.BasePage;
import com.p2p.base.util.DateUtil;

/**
 * @author ruiqi
 *
 */
public class AccountQueryForm extends BasePage {

	private String startDate;

	private String endDate;

	private String transCode;

	private String direction;

	private String queryString;

	protected Map<String, Object> params = new HashMap<String, Object>();

	public Map<String, Object> getParams() {
		return params;
	}

	public void setParams(Map<String, Object> params) {
		this.params = params;
	}
	
	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public String getTransCode() {
		return transCode;
	}

	public void setTransCode(String transCode) {
		this.transCode = transCode;
	}

	public String getDirection() {
		return direction;
	}

	public void setDirection(String direction) {
		this.direction = direction;
	}

	public String getQueryString() {
		return queryString;
	}

	public void setQueryString(String queryString) {
		this.queryString = queryString;
	}

	public void initQueryString() {
		StringBuilder sb = new StringBuilder();
		if (StringUtils.isNotBlank(transCode)) {
			sb.append("transCode=" + transCode);
		}
		if (startDate != null) {
			sb.append("startDate=" + DateUtil.getYYYYMMDDStr(startDate));
		}
		if (endDate != null) {
			sb.append("endDate=" + DateUtil.getYYYYMMDDStr(endDate));
		}
		this.queryString = sb.toString();
	}

}
